<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="bootstrap.css">
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <h2 class="text-center">图书列表</h2>
        </div>
    </div>
    <div class="row" style="margin: 20px 0">
        <div class="col-md-8 col-md-offset-2 text-center">
            <form action="index.php" class="form-inline">
                <div class="form-group">
                    <label for="book_name">快速查询</label>
                    <input type="text" name="book_name" id="book_name" class="form-control">
                    <input type="submit" value="查询" class="btn btn-primary">
                    <input type="submit" value="全部" class="btn btn-warning">
                    <a href="add_book.html" class="btn btn-danger">添加</a>
                </div>
            </form>
        </div>
    </div>
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <table class="table table-hover">
                <thead>
                <tr class="warning">
                    <th>ID</th>
                    <th>图书名称</th>
                    <th>图书类别</th>
                    <th>图书价格</th>
                    <th>出版日期</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach($books as $v) { ?>
                <tr>
                    <td><?=$v['id']?></td>
                    <td><?=$v['name']?></td>
                    <td><?=$v['category']?></td>
                    <td><?=$v['price']?></td>
                    <td><?=$v['publish_time']?></td>
                    <td>
                        <a href="edit.php?id=<?=$v['id']?>" class="btn btn-warning">编辑</a>
                        <a href="delete.php?id=<?=$v['id']?>" class="btn btn-danger" onclick="return confirm('确认删除吗？')">删除</a>
                    </td>
                </tr>
                <?php } ?>
                </tbody>
                <tfoot>
                <tr class="text-center">
                    <td colspan="6">
                        总共<?=$number?>条
                    </td>
                </tr>
                <tr class="text-center">
                    <td colspan="6">
                        <?php
                        echo makePageHtml($page,$maxpage);
                        ?>
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>
</body>
</html>